package com.huluobo.a2206douyindemo.mvvmdemo;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.huluobo.a2206douyindemo.mvpdemo.UserBean;

/**
 * Created by LC on 2024/8/14.
 */
public class LoginDemoViewModel extends ViewModel {
    //提供实际的liveData
    MutableLiveData<UserBean> success = new MutableLiveData<>();
    MutableLiveData<String> failed = new MutableLiveData<>();

    //创建数据仓库
    LoginDemoRepo loginDemoRepo = new LoginDemoRepo();

    //发起repo中的请求,传递数据
    public void login(String username, String password) {
        loginDemoRepo.login(username, password, success, failed);
    }
}
